package com.gosling.gosling.mobao;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.SerializeUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.gosling.cloudspace.common.annotation.TrimAndDic;
import com.gosling.cloudspace.common.entity.dtos.LoginDto;
import com.gosling.cloudspace.common.entity.dtos.OrderInfoDto;
import lombok.SneakyThrows;
import org.apache.commons.lang.StringUtils;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.cglib.beans.BeanGenerator;
import org.springframework.cglib.beans.BeanMap;

import java.beans.IntrospectionException;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CyclicBarrier;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.locks.ReentrantLock;

/**
 * @Software: IntelliJ IDEA
 * @Addresses: www.gosling.com
 * @Email 1793327033@qq.com
 * @Classname lhltest
 * @Author: lihonglin
 * @Date: 2021/8/8 17:36
 */
@SuppressWarnings("all")
@SpringBootTest(classes = MobaoInterviewTest.class)
@SpringBootApplication
public class MobaoInterviewTest {

    static volatile int n = 0;

    private static final AtomicInteger ctl = new AtomicInteger(ctlOf(-1 << (Integer.SIZE - 3), 0));
    private static final int COUNT_BITS = Integer.SIZE - 3;
    private static final int COUNT_MASK = (1 << COUNT_BITS) - 1;

    private static final int RUNNING = -1 << COUNT_BITS;
    private static final int SHUTDOWN = 0 << COUNT_BITS;
    private static final int STOP = 1 << COUNT_BITS;
    private static final int TIDYING = 2 << COUNT_BITS;
    private static final int TERMINATED = 3 << COUNT_BITS;

    private static int runStateOf(int c) {
        return c & ~COUNT_MASK;
    }

    private static int workerCountOf(int c) {
        return c & COUNT_MASK;
    }

    private static int ctlOf(int rs, int wc) {
        return rs | wc;
    }

    private static boolean runStateLessThan(int c, int s) {
        return c < s;
    }

    private static boolean runStateAtLeast(int c, int s) {
        return c >= s;
    }

    private static boolean isRunning(int c) {
        return c < SHUTDOWN;
    }

//    private static final Unsafe U = Unsafe.getUnsafe();


    public static void main(String[] args) throws Exception {
        System.out.println(extracted2());
    }


    private static Object extracted3() {
//        LoanInfoVO obj = new LoanInfoVO();
//        obj.setName("name111");
//        obj.setOrderNo("111");
//        Class clazz = obj.getClass();
//        Field[] fields = clazz.getDeclaredFields();
//        //为实体类添加字段
//        BeanGenerator beanGenerator = new BeanGenerator();
//        beanGenerator.setSuperclass(clazz);
//        for (Field field : fields) {
//            field.setAccessible(true);
//            String name = field.getName();
//            //添加字段 举例为中文字段
//            beanGenerator.addProperty(name + "Dic", String.class);
//        }
//        //创建代理对象[动态代理]
//        Object proxyInstance = beanGenerator.create();
//        //深度克隆
//        BeanUtil.copyProperties(clazz, proxyInstance);
//        //为新增字段设置值
//        BeanMap beanMap = BeanMap.create(proxyInstance);
//        beanMap.put("nameDic", "123");
//        return proxyInstance;
        return null;
    }

    private static Object extracted2() {
        OrderInfoDto obj = new OrderInfoDto();
        obj.setOrderName("order");
        obj.setPayMoney("pay");
        Class clazz = obj.getClass();
        Field[] fields = clazz.getDeclaredFields();
        //为实体类添加字段
        BeanGenerator beanGenerator = new BeanGenerator();
        beanGenerator.setSuperclass(clazz);
        for (Field field : fields) {
            field.setAccessible(true);
            String name = field.getName();
            //添加字段 举例为中文字段
            beanGenerator.addProperty(name + "Dic", String.class);
        }
        //创建代理对象[动态代理]
        Object proxyInstance = beanGenerator.create();
        //深度克隆
        BeanUtil.copyProperties(clazz, proxyInstance);
        //为新增字段设置值
        BeanMap beanMap = BeanMap.create(proxyInstance);
        //只有在map里面能打印，在实体类里面不能打印
        //前提是需要把实体类里面添加Dic字段，就可以打印
        //如果不添加字段表，响应给前端也是能展示的
//        System.out.println(beanMap);
        //{payMoney=null, payMoneyDic=null, orderNameDic=null, orderName=null}
//        System.out.println(proxyInstance);
        beanMap.put("loanInterestRateDic", "123");
        System.out.println(beanMap.get("loanInterestRateDic"));
        return proxyInstance;
    }

    private static void b() {
        System.out.println("//===========================================深===================================");
        OrderInfoDto old = new OrderInfoDto();
        old.setOrderName("旧数据");
        old.setLoginDto(new LoginDto());
        System.out.println("源数据：" + old);
        //深拷贝，调用克隆必须实现Serializable接口或者克隆接口二选一
        OrderInfoDto cloneShen = ObjectUtil.clone(old);
        cloneShen.getLoginDto().setPassword("45454");
        cloneShen.setOrderName("新数据");
        //打印为新数据
        System.out.println(cloneShen);
        //打印为旧数据
        System.out.println(old);
    }

    private static void a() {
        System.out.println("//===========================================浅【引用拷贝】===================================");
        OrderInfoDto old = new OrderInfoDto();
        old.setOrderName("旧数据");
        old.setLoginDto(new LoginDto());
        System.out.println("源数据：" + old);
        //直接赋值是浅拷贝，如果当前克隆对象更改，源对象也会更新
        //OrderInfoDto cloneQian = new OrderInfoDto();也属于浅拷贝将old->cloneQian地址指向关系
        OrderInfoDto cloneQian = new OrderInfoDto();
        BeanUtil.copyProperties(old, cloneQian);
        cloneQian.setOrderName("新数据");
        cloneQian.getLoginDto().setPassword("12");
        //打印为新数据
        System.out.println(cloneQian);
        //打印为新数据
        System.out.println(old);
        //源数据：OrderInfoDto(orderName=旧数据, payMoney=null)
        //OrderInfoDto(orderName=新数据, payMoney=null)
        //OrderInfoDto(orderName=新数据, payMoney=null)
    }

    private static void extracted1() {
        //        Long a = null;
//        long feeMoney = Optional.ofNullable(2l).orElse(1L);
//        feeMoney += Optional.ofNullable(2l).orElse(1L);
//        System.out.println(feeMoney);
//
//        KeyGenerator keyGen= KeyGenerator.getInstance("DESede");


//        int a = 2;
//        new HashMap<Integer, Integer>();
//
//        Integer.valueOf("a");
        Object o = new Object();
        Object o1 = new Object();
        Object o2 = new Object();
//        boolean b = U.compareAndSetObject(o, 2, o1, o2);
        outer:
        for (int i = 0; i < 10; i++) {
//            goto : a();
//            break outer;
        }
//
        CyclicBarrier cyclicBarrier = new CyclicBarrier(10, () -> System.out.println("队伍加载完成，正在进入游戏"));
        for (int i = 0; i < 10; i++) {
            new Thread(() -> {
                try {
                    Thread.sleep(1000);
                    System.out.println(Thread.currentThread().getName() + "加载完成");
                    cyclicBarrier.await();//屏障
                } catch (Exception e) {
                    e.printStackTrace();
                }
                System.out.println(Thread.currentThread().getName() + "进入游戏");
            }).start();
        }

//        System.out.println(myAtoi("12345"));


        HashMap<List<String>, Object> map = new HashMap<>();
        final List<String> list = new ArrayList<>();
        list.add("hello");
        map.put(list, new Object());
        System.out.println(map.get(list));

        list.add("hello world");
        System.out.println(map.get(list));

        map.entrySet().iterator().next();
        map.entrySet().parallelStream().forEach(entry -> System.out.println("1"));


//        ThreadLocal a = new ThreadLocal();
//        a.get();
//        a.set();
    }


    public static int myAtoi(String s) {
        char[] chars = s.toCharArray();
        int len = chars.length;
        //1.去空格
        int index = 0;
        while (index < len && chars[index] == ' ')
            index++;
        //2.排除极端情况 "    "
        if (index == len) return 0;
        //3.设置符号
        int sign = 1;
        char firstChar = chars[index];
        if (firstChar == '-') {
            index++;
            sign = -1;
        } else if (firstChar == '+') {
            index++;
        }
        int res = 0, last = 0; //last 记录上一次的res，以此来判断是否溢出
        while (index < len) {
            char c = chars[index];
            //判断范围，ascall码表是有序的
            if (c < '0' || c > '9') break;
            //char进行计算是直接用的ascall码表计算
            //例如：'2'-'0'则为：50-48=2
            //则对应当前数字为2
            int tem = c - '0';
            last = res;
            //一位一位计算则需要进位相加
            res = res * 10 + tem;
            if (last != res / 10)  ////如果不相等就是溢出了
                return (sign == (-1)) ? Integer.MIN_VALUE : Integer.MAX_VALUE;
            index++;
        }
        return res * sign;
    }


    private static void 萨达撒大声地() {
        String[] arg = {"fower", "fow", "fight"};
        System.out.println(longestCommonPrefix(arg));

////        //代码块1
//        short s1 = 1; s1 = s1 + 1;
//////        //代码块2
////        short s1=1; s1+=1;
//        //代码块3
////        short s1=1; s1++;
    }

    public static String longestCommonPrefix(String[] strs) {
        if (strs.length == 0) return "";
        String res = strs[0];
        for (int i = 1; i < strs.length; i++) {
            int j = 0;
            while (j < res.length() && j < strs[i].length() && res.charAt(j) == strs[i].charAt(j)) {
                j++;
            }
            res = res.substring(0, j);
        }
        return res;
    }


    public static int romanToInt(String s) {
        if (s == null) throw new IllegalArgumentException("s must not be null");
        if (!(s.length() >= 1 && s.length() <= 15)) throw new IllegalArgumentException("s must be between");
        HashMap<String, Integer> hashMap = new HashMap<>();
        hashMap.put("I", 1);
        hashMap.put("V", 5);
        hashMap.put("X", 10);
        hashMap.put("L", 50);
        hashMap.put("C", 100);
        hashMap.put("D", 500);
        hashMap.put("M", 1000);
        hashMap.put("M", 1000);
        hashMap.put("a", 4);
        hashMap.put("b", 9);
        hashMap.put("c", 40);
        hashMap.put("d", 90);
        hashMap.put("e", 400);
        hashMap.put("f", 900);

        s = s.replace("IV", "a")
                .replace("IX", "b")
                .replace("XL", "c")
                .replace("XC", "d")
                .replace("CD", "e")
                .replace("CM", "f");

        Integer sum = 0;
        for (int i = 0; i < s.length(); i++) {
            Integer a = hashMap.get(String.valueOf(s.charAt(i)));
            sum += (a == null ? 0 : a);
        }
        return sum;
    }


    public static int[] sort1(int[] arr) {

        for (int i = 0; i < arr.length; i++) {

            for (int j = 0; j < arr.length - 1 - i; j++) {
                int temp;
                if (arr[j] > arr[j + 1]) {
                    temp = arr[j];
                    arr[j] = arr[j + 1];
                    arr[j + 1] = temp;
                    System.out.println(Arrays.toString(arr).toString());
                }
            }

        }

        return arr;
    }

    public int[] sort(int[] arr) {
        int len = arr.length;
        for (int i = 0; i < len; i++) {
            for (int j = i + 1; j < len; j++) {
                int temp;
                if (arr[i] > arr[j]) {
                    temp = arr[j];
                    arr[j] = arr[i];
                    arr[i] = temp;
                }
            }
        }
        System.out.println("冒泡排序");
        return arr;
    }

    private static void extracted() {
        Thread thread1 = new Thread(new Runnable() {
            @SneakyThrows
            @Override
            public void run() {
                System.out.println("A");
            }
        });

        Thread thread2 = new Thread(new Runnable() {
            @SneakyThrows
            @Override
            public void run() {
                thread1.start();
                thread1.join();
                System.out.println("B");
            }
        });

        Thread thread3 = new Thread(new Runnable() {
            @SneakyThrows
            @Override
            public void run() {
                thread2.start();
                thread2.join();
                System.out.println("C");
            }
        });

        thread3.start();
    }


    public static int getInt() {
        int a = 10;
        try {
            System.out.println(a / 0);
            a = 20;
        } catch (ArithmeticException e) {
            a = 30;
            return a;
        } finally {
            a = 40;
            return a;
        }
    }

    public static String getInt1() throws Exception {
        String a = "10";
        try {
            if (a.equals("10")) {
                throw new ArithmeticException("异常");
            }
            a = "20";
        } catch (ArithmeticException e) {
            a = "30";
            return a;
        } finally {
            a = "40";
        }
        return a;
    }


//    private static boolean check() {
//        try {
//            Tika tika = new Tika();
//            File file = new File("xxx");
//            InputStream inputStream = new FileInputStream(file);
//            tika.parseToString(inputStream);
//            tika.parseToString(file);
//            return true;
//        } catch (Exception e) {
//            e.printStackTrace();
//            return false;
//        }
//    }

    private static void sadasd() throws IllegalAccessException, InvocationTargetException, IntrospectionException {
        //        int c = ctl.get();
//        int c = 10;
//        System.out.println(c + "---" + STOP);
//
//        System.out.println(runStateAtLeast(c, STOP));
//        System.out.println(runStateLessThan(c, SHUTDOWN));
//        System.out.println(workerCountOf(c));
//        System.out.println(ctlOf(1, 3));
//        System.out.println(ctlOf(1, workerCountOf(c)));
//        //-1
//        System.out.println(0b11111111111111111111111111111111);
//        System.out.println("1100000000000000000000000000000".length());


//        lengthOfLongestSubstring("abcabcbb");


//        String s = "Java\nPython\nRuby";
//        s.lines().forEach(System.out::println);
//
//        System.out.println("A".repeat(10));
//
//        String s1 = " Hello, JDK11!\u3000\u3000      ";
//        System.out.println("     original: [" + s1 + "]");
//        System.out.println("         trim: [" + s1.trim() + "]");
//        System.out.println("        strip: [" + s1.strip() + "]");
//        System.out.println(" stripLeading: [" + s1.stripLeading() + "]");
//        System.out.println("stripTrailing: [" + s1.stripTrailing() + "]");


//        StudentInfo s = new StudentInfo();
//
//        Integer a = 1;
//        Integer b = 1;
//
//        Integer c = 300;
//        Integer d = 300;
//        int e = 300;
//
//        System.out.println(a == b);
//        System.out.println(c == d);
//        System.out.println(e == d);


//        int sum = 2;
//        System.out.println(addToSum(sum));


//        ArrayList list = new ArrayList();
//
//        System.out.println(Integer.MAX_VALUE - 8);
//
//
//        System.out.println(OrderInfoDto.class.getClassLoader());
//        System.out.println(OrderInfoDto.class.getClassLoader().getParent());
//        System.out.println(OrderInfoDto.class.getClassLoader().getParent().getParent());
//        System.out.println(OrderInfoDto.class.getClassLoader());


    }

    private static void abc() throws IllegalAccessException, InvocationTargetException, IntrospectionException {
        OrderInfoDto obj = new OrderInfoDto();
        obj.setOrderName("order");
        obj.setPayMoney("pay");
        Class clazz = obj.getClass();
        Field[] fields = clazz.getDeclaredFields();
        //为实体类添加字段
        BeanGenerator beanGenerator = new BeanGenerator();
        beanGenerator.setSuperclass(clazz);
        for (Field field : fields) {
            field.setAccessible(true);
            String name = field.getName();
            //拿到字段的值：方法一
            Object value = field.get(obj);
            //拿到字段的值：方法二
            //Object value2 = new PropertyDescriptor(name, clazz).getReadMethod().invoke(obj);
            //拿到字段的值：方法三
            //Object value3 = ReflectionUtils.findMethod(clazz, "getOrderName").invoke(obj);
            //获取字段类型
            if (field.getType() == String.class) {
                //给字段赋值
                field.set(obj, String.valueOf(value));
            }
            //对数据字典的字段需要补齐0的进行处理
            if (field.isAnnotationPresent(TrimAndDic.class)) {
                //如果字段包含了注解 TODO
            }
            //添加字段 举例为中文字段
            beanGenerator.addProperty(name + "Dic", String.class);
        }
        //创建代理对象[动态代理]
        Object proxyInstance = beanGenerator.create();
        //深度克隆
        BeanUtil.copyProperties(clazz, proxyInstance);
        //为新增字段设置值
        BeanMap beanMap = BeanMap.create(proxyInstance);
        //只有在map里面能打印，在实体类里面不能打印
        //前提是需要把实体类里面添加Dic字段，就可以打印
        //如果不添加字段表，响应给前端也是能展示的
        System.out.println(beanMap);
        //{payMoney=null, payMoneyDic=null, orderNameDic=null, orderName=null}
        System.out.println(proxyInstance);
        //OrderInfoDto(orderName=null, payMoney=null)
    }

    public static Integer addToSum(int sum) {
        if (sum == 1) {
            return 1;
        }
        return addToSum(sum - 1) + 1;
    }


    private synchronized static void A(String s) {
        System.out.println("A");
        B(s);
    }

    private synchronized static void B(String s) {
        System.out.println("B");
        System.out.println(s);
//        A("c");
    }

    /***
     * 输入: s = "abcabcbb"
     * 输出: 3
     * 解释: 因为无重复字符的最长子串是 "abc"，所以其长度为 3。
     *
     * @param s
     * @return
     */
    public static int lengthOfLongestSubstring(String s) {

        int n = s.length(), ans = 0;
        Map<Character, Integer> map = new HashMap<>();
        for (int end = 0, start = 0; end < n; end++) {
            char alpha = s.charAt(end);
            if (map.containsKey(alpha)) {
                start = Math.max(map.get(alpha), start);
            }
            ans = Math.max(ans, end - start + 1);
            map.put(s.charAt(end), end + 1);
        }
        System.out.println(ans);

        return ans;
    }

    private static void sadsadas() {
        //        ThreadPool threadPoolTaskConfig = new ThreadPool();
//        threadPoolTaskConfig.taskExecutor().execute(a->{});
//        System.out.println("新建：" + Thread.State.NEW);
//        System.out.println("运行：" + Thread.State.RUNNABLE);
//        System.out.println("阻塞：" + Thread.State.BLOCKED);
//        System.out.println("等待：" + Thread.State.WAITING);
//        System.out.println("超时等待：" + Thread.State.TIMED_WAITING);
//        System.out.println("终止：" + Thread.State.TERMINATED);
//        ArrayList<Object> objects = new ArrayList<>();
//        objects.add("");
//        objects = null;
//        HashMap<Object, Object> hashMap = new HashMap<>();
//        hashMap.put("111", "1");
//        hashMap.put("11122222", "1");
//        hashMap.put(null, "1");
//        System.out.println(hashMap);
//        Thread.currentThread().getState().equals(Thread.State.RUNNABLE);


//        OrderInfoDto orderInfoDto = new OrderInfoDto();
//        orderInfoDto.setOrderName("123");
//
//        System.out.println(orderInfoDto);
//
//        OrderInfoDto orderInfoDto2 = new OrderInfoDto();
//        orderInfoDto2 = orderInfoDto;
//        orderInfoDto2.setOrderName("1234");
//
//
//            orderInfoDto2.wait(20);
//            System.out.println("执行了wait");
//
//        try {
//            System.out.println(orderInfoDto2);
//            System.out.println(orderInfoDto);
//            return;
//        } catch (Exception e) {
//            e.printStackTrace();
//        } finally {
//            return;
//        }

//        BeanUtil.copyProperties();


//        System.out.println(0 | 3);
//        System.out.println(~Integer.SIZE);
//        System.out.println(~7);
////        System.out.println((1 << (Integer.SIZE - 3)) - 1);
//
//        int COUNT_BITS = Integer.SIZE - 3;
//        System.out.println("RUNNING   :" + (-1 << COUNT_BITS));
//        System.out.println("SHUTDOWN  :" + (0 << COUNT_BITS));
//        System.out.println("STOP      :" + (1 << COUNT_BITS));
//        System.out.println("TIDYING   :" + (2 << COUNT_BITS));
//        System.out.println("TERMINATED:" + (3 << COUNT_BITS));
//
//        ConcurrentHashMap<Object, Object> map = new ConcurrentHashMap<>();
//        map.get("");
    }


    private static void fdsafsaf(String s) throws NullPointerException {
        if (s == null) {
            throw new NullPointerException();
        }
        ArrayList<Object> objects = new ArrayList<>();
        ConcurrentHashMap concurrentHashMap = new ConcurrentHashMap<>();
        Hashtable hashtable = new Hashtable<>();
        concurrentHashMap.put("1", "null");
        objects.add(null);
        objects.add(null);
        System.out.println(0x7FFFFFFF);
        System.out.println(1 << 1);
    }

    private static void extracted(ReentrantLock reentrantLock) throws Exception {
        int holdCount = 0;
        try {
            reentrantLock.lock();
            holdCount = reentrantLock.getHoldCount();
            System.out.println("holdCount[加了" + holdCount + "次锁]");
            if (holdCount == 5) {
                System.out.println("释放=====");
                return;
            }
            extracted(reentrantLock);
        } finally {
            reentrantLock.unlock();
            n++;
            System.out.println("holdCount[解了" + n + "次锁,第" + holdCount + "把锁]");
        }
    }

    private static int 有效括号() {
        //输入：s = "(()"
        //输出：2
        //解释：最长有效括号子串是 "()"

        String s = "((()";
        if (s.contains("()")) {
            String replaceAll = s.replaceAll("", "");
            int lengthNew = replaceAll.length();


            int lengthOld = s.length();

            int c = lengthOld - lengthNew;


            System.out.println(lengthNew);
            System.out.println(lengthOld);
//            System.out.println(c);
            System.out.println(replaceAll);
            System.out.println(s);
            return c;
        } else {
            return 9999;
        }
    }

    private static void sadasdasda() {
        int[] nums2 = {1, 2, 2, 1};
        int[] nums1 = {2, 2};

//        int[] nums1 = {4,9,5};
//        int[] nums2 = {9,4,9,8,4};
        int[] extracted = 它们的交集(nums1, nums2);
    }

    private static int[] 它们的交集(int[] nums1, int[] nums2) {
        ArrayList<String> nums11 = new ArrayList<>();
        for (int i : nums1) {
            nums11.add(String.valueOf(i));
        }
        ArrayList<String> nums22 = new ArrayList();
        for (int i : nums2) {
            nums22.add(String.valueOf(i));
        }
        HashMap<String, Integer> map = map2Get(nums22);
        HashMap<String, Integer> map2 = map2Get(nums11);
        HashMap<String, Integer> map3 = new HashMap<>();
        map.forEach((k, v) -> {
            map2.forEach((k2, v2) -> {
                if (k.equals(k2)) {
                    map3.put(k, v2 >= v ? v : v2);
                }
            });
        });
        ArrayList list = new ArrayList();
        map3.forEach((k, v) -> {
            for (Integer i = 0; i < v; i++) {
                list.add(k);
            }
        });
        System.out.println(list);
        int[] nums = new int[nums11.size()];
        int index = 0;
        for (Object o : nums11) {
            nums[index] = Integer.valueOf(o.toString());
            index++;
        }
        return nums;
    }

    private static HashMap<String, Integer> map2Get(ArrayList<String> nums22) {
        HashMap<String, Integer> map = new HashMap<>();
        for (Object key : nums22) {
            Integer integer = map.get(key);
            if (integer != null) {
                integer = integer + 1;
                map.put(key.toString(), integer);
            } else {
                map.put(key.toString(), 1);
            }
        }
        return map;
    }

    public static Set<String> intersectionSet(Set<String> set1, Set<String> set2) {
        Set<String> intersectionSet = new HashSet<>(set1);
        intersectionSet.addAll(set1);
        intersectionSet.retainAll(set2);
        System.out.println(intersectionSet);
        return intersectionSet;
    }

    private static void sadfas() {
        int a = 3;
        int b = 4;
        a = a * b;
        System.out.println(a);
        System.out.println(a / b);
    }

    private static void testExportPool() {
//        Map<String, String> paramsMap = HttpContextUtils.getAllParams(request);
//        List<String> cusNos = commonService.getAllMerchNos(1);
//        //数据库总条数
//        long dataCount = orderInfoService.totalCount(paramsMap, cusNos);
//        log.info("查询到数据总条数为{}条", dataCount);
//        String tempFolderPath = temp + File.separator + ExcelExportNameCons.TRADE_ORDER_QUERY + File.separator;
//        //用lambda方式实现接口 并将实现后重写的方法和service一并带入
//        generalUtil.threadWriteShardingByFile((currPage, pageSize, cusNoList) -> orderInfoService.getOrderInfo(new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(currPage, pageSize), paramsMap, cusNos),
//                OrderInfoExcle.class,
//                ExcelExportNameCons.TRADE_ORDER_QUERY,
//                tempFolderPath,
//                "交易订单查询",
//                "交易订单查询",
//                "交易订单查询",
//                dataCount,
//                cusNos,
//                response);
//        log.info("交易订单查询导出结束");
    }

    private static long getBetweenMinute() {
        Calendar cal = Calendar.getInstance();
        cal.setTime(DateUtil.parse("2023-06-21 10:31:00"));
//        cal.add(Calendar.DAY_OF_YEAR, 1);
//        cal.set(Calendar.HOUR_OF_DAY, 0);
//        cal.set(Calendar.SECOND, 0);
//        cal.set(Calendar.MINUTE, 0);
//        cal.set(Calendar.MILLISECOND, 0);
        return (cal.getTimeInMillis() - System.currentTimeMillis()) / 1000 / 60;
    }

    private static void JSON格式添加引号() {
        String x = "[payeeIdNum:+Q30dbhEybs8CGwKVwHXL6+4h0on46YT6JM9tZ+6nls=-->null],[reserveMobileNo:UaVe93YvkJVXk1TsvZ0QmQ==-->null],[province:四川省-->天津市],[provinceCode:6500-->1100],[city:成都市-->天津市],[cityCode:6510-->1100],[branchBankName:中信银行成都分行-->中国工商银行股份有限公司天津分行营业部],[branchBankNo:302651041101-->102110000017]";
        x = StringUtils.reverse(StringUtils.reverse(x.replaceFirst("\\[", "{")).replaceFirst("\\]", "}"));
        x = x.replaceAll("\\[", "").replaceAll("]", "");
//        x = x.replaceAll("(\\w+)\\s*:","\"$1\":");
        x = x.replaceAll("(\\w+):(.*?)([,|}])", "\"$1\":\"$2\"$3");
        System.out.println(x);
        System.out.println(JSONUtil.toJsonStr(x));

        JSONObject jsonObject = JSONUtil.parseObj(JSONUtil.formatJsonStr(x));
//        System.out.println(jsonObject.toString());
        System.out.println(jsonObject.getStr("bankName"));
    }

    private static void JSON格式添加引号1() {
        String x = "[managerEmail:825998239@qq.com-->8259982391@qq.com]";
        x = StringUtils.reverse(StringUtils.reverse(x.replaceFirst("\\[", "{")).replaceFirst("\\]", "}"));
        x = x.replaceAll("\\[", "").replaceAll("]", "");
//        x = x.replaceAll("(\\w+)\\s*:","\"$1\":");
        x = x.replaceAll("(\\w+):(.*?)([,|}])", "\"$1\":\"$2\"$3");
        System.out.println(x);
        System.out.println(JSONUtil.toJsonStr(x));

        JSONObject jsonObject = JSONUtil.parseObj(JSONUtil.formatJsonStr(x));
//        System.out.println(jsonObject.toString());
        System.out.println(jsonObject.getStr("bankName"));

        String objectStr = jsonObject.getStr("managerTel");
        String[] valueOldNew = objectStr.split("-->");
    }

    private static void sssss() throws Exception {
//        System.out.println("快捷支付借记卡、快捷支付贷记卡、协议支付借记卡、提现、支付宝APP支付、支付宝H5支付、企业网银、网银贷记卡、支付宝扫码、协议支付贷记卡、网银混合、微信H5支付、余额支付、公众号支付、电报费、网银借记卡、");
//        System.out.println(Validator.isMobile("13628114992"));
//        System.out.println(Validator.isMobile("13117607859"));
//        System.out.println(SenseFieldTool.decryptMode("hnTmbYavIe3p5Yyfx4Iqs+OKMr6QTZty6HOCopaEDRc="));
//        System.out.println(SenseFieldTool.encryptMode("13117607859"));
    }
}
